﻿using MySql.Data.MySqlClient;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace WebApplication1
{
    public partial class WebForm3 : System.Web.UI.Page
    {
        //查看数据库
        protected void Page_Load(object sender, EventArgs e)
        {
            MySqlConnection cn = new MySqlConnection("server=localhost;uid = root;database=data");
            //2）适配器帮我们查数据  参数：1）查什么 2）数据连接管道
            MySqlDataAdapter mySqlDataAdapter = new MySqlDataAdapter("select* from student", cn);
            //3)创建一个内存容器，创建一个空容器
            DataSet ds = new DataSet();
            //4)将数据从适配器中填入到容器中
            mySqlDataAdapter.Fill(ds);
            //数据表格绑定
            Repeater1.DataSource = ds;
            Repeater1.DataBind();
        }
    }
}